<template>
    <app-home>
        <div slot='main'>
            <Table stripe :columns="columns" :data="rows">
                <template slot-scope="{ row, index }" slot="action">
                    <Button type="primary" size="small" style="margin-right: 5px" @click="show(index)">修改</Button>
                    <Button type="error" size="small" @click="remove(index)">删除</Button>
                </template>
            </Table>
        </div>
    </app-home>
</template>

<script>
import Home from "@/views/home"
import expandRow from './components/table-expand';
export default {
   components:{
       "app-home":Home
   },
    data(){
        return{
                columns:[
                    {
                        type: 'expand',
                        align:'left',
                        render: (h, params) => {
                            return h(expandRow, {
                                props: {
                                    row: params.row
                                }
                            })
                        }
                    },
                    {
                        type: 'selection',
                        width: 60,
                        align: 'center'
                    },
                     {
                        title: '用户昵称',
                        key: 'person_name',
                        align:'left'
                        // ,
                        // render:(h,params)=>{
                        //     // this.$store.dispatch("GetIdUser",params.row.person_name).then(()=>{
                        //     //     return h("span",['s']);
                        //     // });
                        //     console.log(this.$store);
                        // }
                    },
                     {
                        title: '类型',
                        key: 'modules_type',
                        align:'left'
                    },
                     {
                        title: '细分',
                        key: 'type',
                        align:'left'
                    },
                     {
                        title: '点赞',
                        key: 'good',
                        align:'center'
                    },
                     {
                        title: '优质评论',
                        key: 'status',
                        align:'center'
                    },
                     {
                        title: '发表时间',
                        key: 'pro_data',
                        align:'center'
                    },
                     {
                        title: '地址',
                        key: 'source',
                        align:'center'
                    },
                     {
                        title: '操作',
                        slot: 'action',
                        width: 150,
                        align: 'center'
                    }
                ],
                rows:[]//数据放在这里
            }
        },
    mounted(){
        this.ListCommentType();
        },
    methods:{
            ListCommentType(){
                this.$store.dispatch("ListCommentType").then(()=>{
                    this.rows=this.$store.state.comment.data.rows;
                    console.log(this.$store.state.cate);
                });
            }
        }
}
</script>
